#include "bbs.h"
#include "bbstelnet.h"
/* bbs.c */
int show_cake(void);
void do_delay(int i);
int underline_post(int ent, struct fileheader *fileinfo, char *direct);
int allcanre_post(int ent, struct fileheader *fileinfo, char *direct);
void setqtitle(char *stitle);
int chk_currBM(struct boardheader *bh, int isbig);
void setquotefile(char filepath[]);
char *setuserfile(char *buf, char *filename);
char *setbpath(char *buf, char *boardname);
char *setbfile(char *buf, char *boardname, char *filename);
int deny_me(char *bname);
void shownotepad(void);
int g_board_names(struct boardmem *fhdrp, void *param);
void make_blist(void);
int g_board_names_full(struct boardmem *fhdrp, void *param);
void make_blist_full(void);
int junkboard(void);
void Select(void);
int postfile(char *filename, char *nboard, char *posttitle, int mode);
int get_a_boardname(char *bname, char *prompt);
int do_cross(int ent, struct fileheader *fileinfo, char *direct);
int cmpfilename(struct fileheader *fhdr);
int digest_post(int ent, struct fileheader *fhdr, char *direct);
int do_reply(struct fileheader *fh);
int transferattach(char *buf, int size, FILE *fp, FILE *fpto);
void do_quote(char *filepath, int quote_mode);
int do_post(void);
void add_loginfo(char *filepath);
void add_crossinfo(char *filepath, int mode);
int show_board_notes(char bname[30]);
int stringfilter(char *title, int mode);
int edit_post(int ent, struct fileheader *fileinfo, char *direct);
int mark_post(int ent, struct fileheader *fileinfo, char *direct);
int markdel_post(int ent, struct fileheader *fileinfo, char *direct);
int addtop_post(int ent, struct fileheader *fileinfo, char *direct);
int del_range(int ent, struct fileheader *fileinfo, char *direct);
int del_post(int ent, struct fileheader *fileinfo, char *direct);
int Save_post(int ent, struct fileheader *fileinfo, char *direct);
int Import_post(int ent, struct fileheader *fileinfo, char *direct);
int check_notespasswd(void);
int what_to_do(void);
int into_announce(void);
int forward_post(int ent, struct fileheader *fileinfo, char *direct);
int forward_u_post(int ent, struct fileheader *fileinfo, char *direct);
int Goodbye(void);
int Info(void);
int Conditions(void);
int Welcome(void);
int cmpbnames(struct boardheader *brec, char *bname);
void setbdir(char *buf, char *boardname, int Digestmode);
int zmodem_sendfile(int ent, struct fileheader *fileinfo, char *direct);
int deleted_mode(void);
int junk_mode(void);
int marked_mode(void);
int thread_mode(void);
void board_attach_link(char *buf, int buf_len, long attachpos, char *attachname, void *arg);
typedef void  (*generate_attach_link_t)(char* ,int,long ,char *,void* );
void register_attach_link(generate_attach_link_t fn,void* arg);
int post_check_perm(char *boardname);
int deny_me_global(void);
/* record.c */
long get_num_records(char *filename, int size);
int apply_record(char *filename, int (*fptr)(void *), int size);
int get_record(char *filename, void *rptr, int size, int id);
int get_records(char *filename, void *rptr, int size, int id, int number);
int get_records_extra(char *filename, char *rptr, int size, int id, int number, int filetotal, char *extrabuf, int nextra);
int substitute_record(char *filename, void *rptr, int size, int id);
int insert_record(char *fpath, void *data, int size, int pos, int num);
int delete_range(char *filename, int id1, int id2);
int update_file(char *dirname, int size, int ent, int (*filecheck)(void *), void (*fileupdate)(void *));
/* delete.c */
int d_board(void);
void offline(void);
int online(void);
int d_user(void);
int kick_user(struct user_info *userinfo);
/* main.c */
int cmpuids(char *uid, struct userec *up);
void do_abort_bbs(void);
void abort_bbs(void);
void set_numofsig(void);
int main(int argc, char *argv[]);
int egetch(void);
void update_endline(void);
void showtitle(char *title, char *mid);
void docmdtitle(char *title, char *prompt);
int Q_Goodbye(void);
/* stuff.c */
int dashf(const char *fname);
int dashd(char *fname);
int dashl(char *fname);
int pressanykey(void);
int pressreturn(void);
int askyn(char str[80], int defa, int gobottom);
void printdash(char *mesg);
void bell(void);
void strtolower(char *dst, char *src);
/* mail.c */
char *email_domain(void);
int chkmail(void);
int check_query_mail(char qry_mail_dir[80]);
int mailall(void);
void m_internet(void);
void m_init(void);
int m_send(char userid[]);
int M_send(void);
int m_new(void);
int mail_reply(int ent, struct fileheader *fileinfo, char *direct);
int mail_forward(int ent, struct fileheader *fileinfo, char *direct);
int mail_u_forward(int ent, struct fileheader *fileinfo, char *direct);
int m_read(void);
int invalidaddr(char *addr);
int g_send(void);
int ov_send(void);
int club_send(void);
int doforward(char *filepath, char *oldtitle, int mode);
int m_cancel(char userid[]);
int post_reply(int ent, struct fileheader *fileinfo, char *direct);
int mailtoall(int mode, int hour);
int bogomail(void);
int mailsecbm(void);
/* register.c */
void new_register(void);
int invalid_email(char *addr);
void check_register_info(void);
/* xyz.c */
void loaduserkeys(void);
int modify_user_mode(int mode);
int showperminfo(unsigned int pbits, int i, int use_define);
int x_copykeys(void);
int x_setkeys(void);
int x_setkeys2(void);
int x_setkeys3(void);
int x_setkeys4(void);
int x_setkeys5(void);
unsigned int setperms(unsigned int pbits, char *prompt, int numbers, int (*showfunc)(unsigned int, int, int), int param);
int x_level(void);
int x_userdefine(void);
int x_cloak(void);
void x_edits(void);
void a_edits(void);
void x_lockscreen(void);
int heavyload(float maxload);
void x_dict(void);
void x_tt(void);
void x_worker(void);
void x_tetris(void);
void x_winmine(void);
void x_winmine2(void);
void x_recite(void);
void x_ncce(void);
void x_chess(void);
void x_qkmj(void);
void x_quickcalc(void);
void x_freeip(void);
int ent_bnet(char *cmd);
int x_denylevel(void);
int s_checkid(void);
char *directfile(char *fpath, char *direct, char *filename);
int zsend_file(char *from, char *title);
void inn_reload(void);
void datapipefd(int fds, int fdn);
/* talk.c */
int t_pager(void);
int t_query(char q_id[12 + 2]);
int bm_printboard(struct boardmem *bmem, void *param);
void num_alcounter(void);
int num_active_users(void);
int t_cmpuids(int uid, struct user_info *up);
int t_talk(void);
int ttt_talk(struct user_info *userinfo);
int servicepage(int line, char *mesg);
int talkreply(void);
void endmsg(int sig);
int listfilecontent(char *fname);
int addtooverride(char *uident);
int deleteoverride(char *uident, char *filename);
int override_add(void);
void t_friend(void);
void t_reject(void);
struct user_info *t_search(char *sid, int pid, int invisible_check);
int getfriendstr(void);
int getrejectstr(void);
int wait_friend(void);
int Friends(char *userid);
/* read.c */
struct keeploc *getkeep(char *s, int def_topline, int def_cursline);
void fixkeep(char *s, int first, int last);
int inputgotonumber(char ch, int *num);
void printgotonumber(int num);
void i_read(int cmdmode, char *direct, int (*dotitle)(void), char *(*doentry)(int, void *, char *), const struct one_key *rcmdlist, const int ssize);
int auth_search_down(int ent, struct fileheader *fileinfo, char *direct);
int auth_search_up(int ent, struct fileheader *fileinfo, char *direct);
int post_search_down(int ent, struct fileheader *fileinfo, char *direct);
int post_search_up(int ent, struct fileheader *fileinfo, char *direct);
int show_author(int ent, struct fileheader *fileinfo, char *direct);
int friend_author(int ent, struct fileheader *fileinfo, char *direct);
int SR_BMfunc(int ent, struct fileheader *fileinfo, char *direct);
int SR_first_new(int ent, struct fileheader *fileinfo, char *direct);
int SR_last(int ent, struct fileheader *fileinfo, char *direct);
int SR_first(int ent, struct fileheader *fileinfo, char *direct);
int SR_read(int ent, struct fileheader *fileinfo, char *direct);
int SR_author(int ent, struct fileheader *fileinfo, char *direct);
int t_search_down(int ent, struct fileheader *fileinfo, char *direct);
int t_search_up(int ent, struct fileheader *fileinfo, char *direct);
int thread_up(int ent, struct fileheader *fileinfo, char *direct);
int thread_down(int ent, struct fileheader *fileinfo, char *direct);
int sread(int passonly, int readfirst, int pnum, int auser, struct fileheader *ptitle);
int searchpattern(char *filename, char *query);
/* comm_lists.c */
char *sysconf_str(char *key);
int sysconf_eval(char *key);
void load_sysconf(void);
int domenu(char *menu_name);
/* killer.c */
int killer_main(void);
/* namecomplete.c */
void FreeNameList(void);
void CreateNameList(void);
void AddNameList(char *name);
void ApplyToNameList(int ((*fptr)(void)));
int chkstr(char *otag, char *tag, char *name);
int namecomplete(char *prompt, char *data);
int usercomplete(char *prompt, char *data);
/* chat.c */
void printchatline(const char *str);
void chat_clear(void);
void print_chatid(char *chatid);
int ent_chat(char *chatbuf);
void setpager(void);
/* maintain.c */
int check_systempasswd(void);
int setsystempasswd(void);
void penaltyreport(char *title, char *str);
void deliverreport(char *title, char *str);
void securityreport(char *str, char *content);
int get_grp(char seekstr[80]);
void stand_title(char *title);
int m_info(void);
unsigned short int connect_board_to_discuzx(char* title);
int m_newbrd(void);
int m_editbrd(void);
int m_trace(void);
int m_register(void);
int m_ordainBM(void);
int do_ordainBM(const char *userid, const char *abname);
int m_retireBM(void);
int do_retireBM(const char *userid, const char *abname);
int retireBM(char *uid, char *bname);
int retire_allBM(char *uid);
int m_addpersonal(void);
/* edit.c */
struct textLine *allocNextLine(struct textLine *ln);
int indb(char *ptr, int n);
int measureLine(char *p0, int size, int maxwidth, int cutmode, int *width);
int measureWidth(char *ptr, int size);
int reflow(struct textLine *ln, int tillend);
void printTextLine(struct textLine *ln);
int editor(char *filename, int saveheader, int modifyheader);
int write_header(FILE *fp, int deliver);
void addsignature(FILE *fp, int blank);
void keep_fail_post(void);
int vedit(char *filename, int saveheader, int modifyheader);
/* more.c */
int NNread_init(void);
void setcalltime(void);
int countln(char *fname);
void printacbar(void);
void check_calltime(void);
void R_monitor(int sig);
void mem_show(char *ptr, int size, int row, int numlines, char *fn);
int ansimore(char *filename, int promptend);
int ansimore_withzmodem(char *filename, int promptend, char *title);
int ansimore2(char *filename, int promptend, int row, int numlines);
int ansimorestuff(char *filename, int promptend);
int ansimore2stuff(char *filename, int promptend, int row, int numlines);
/* help.c */
void show_help(char *fname);
int mainreadhelp(void);
int mailreadhelp(void);
int selbacknumberhelp(void);
int backnumberhelp(void);
int posttmplhelp(void);
/* bcache.c */
void attach_err(int shmkey, char *name);
void *attach_shm(int shmkey, int shmsize);
void reload_boards(void);
void resolve_boards(void);
int apply_boards(int (*func)(struct boardmem *, void *), void *param);
struct boardmem *getbcache(char *bname);
int updatelastpost(char *board);
int hasreadperm(struct boardheader *bh);
int getbnum(char *bname);
int canberead(char *bname);
int noadm4political(int bnum);
int haspostperm(int bnum);
int posttest(char *uid, char *bname);
int hideboard(char *bname);
int normal_board(char *bname);
int njuinn_board(char *bname);
int innd_board(char *bname);
int is1984_board(char *bname);
int discuzweb_board(char *bname, int bnum);
int political_board(char *bname, int bnum);
int club_board(char *bname, int bnum);
int clubsync(int bnum);
int apply_ulist(int (*fptr)(struct user_info *));
int search_ulist(struct user_info *uentp, int (*fptr)(int, struct user_info *), int farg);
int search_ulistn(struct user_info *uentp, int (*fptr)(int, struct user_info *), int farg, int unum);
int count_logins(struct user_info *uentp, int (*fptr)(int, struct user_info *), int farg, int show);
int t_search_ulist(int uid);
void update_ulist(struct user_info *uentp, int uent);
void update_utmp(void);
int get_utmp(void);
int who_callme(struct user_info *uentp, int (*fptr)(int, struct user_info *), int farg, int me);
int getbmnum(char *userid);
struct user_info *query_uindex(int uid, int dotest);
int count_uindex(int uid);
int count_uindex_telnet(int uid);
int count_unidex_bbsnet(int uid);
char *get_temp_sessionid(char *ts);
void show_small_bm(char *board);
int setbmstatus(int online);
/* boards.c */
void GoodBrds(void);
void EGroup(char *cmd);
void Boards(void);
void New(void);
int unread_position(char *dirfile, struct boardmem *bptr);
void update_postboards(void);
void brc_update(void);
int brc_initial(char *boardname, int keep);
void clear_new_flag_quick(int t);
void clear_all_new_flag(void);
int Read(void);
void loguseboard(void);
int showhell(void);
int showprison(void);
int clubtest(char *board);
int clubtestdenysysop(char *board);
int show_board_info(void);
/* smth_screen.c */
void setdefaultfcolor(int i, int j);
void setdefaultbcolor(int i);
void setfcolor(int i, int j);
void setbcolor(int i);
void resetcolor(void);
int num_noans_chr(char *str);
void clear(void);
void initscr(void);
void refresh(void);
void redoscr(void);
int fakefunc(void);
void move(int y, int x);
void getyx(int *y, int *x);
void clear_whole_line(int i);
void clrtoeol(void);
void clrtobot(void);
void outc(unsigned char c);
void outns(const char *str, int n);
void outs(const char *str);
void prints(char *format, ...);
void scroll(void);
void rscroll(void);
void noscroll(void);
void saveline(int line, int mode, char *buffer);
void do_naws(int ln, int col);
void show_message(char msg[]);
/* io.c */
void oflush(void);
void init_alarm(void);
void add_io(int fd, int timeout);
void add_flush(void (*flushfunc)(void));
int num_in_buf(void);
int igetkey(void);
char askone(int line, int col, char *prompt, char *menu, int dft);
int getdata(int line, int col, char *prompt, char *buf, int len, int echo, int clearlabel);
int raw_write(int fd, char *buf, int len);
int raw_read(int fd, char *buf, int len);
int multi_getdata(int line, int col, int maxcol, char *prompt, char *buf, int len, int maxline, int clearlabel);
void switchSIGALRM(int on);
void switchSIGUSR2(int on);
/* term.c */
void init_tty(void);
void term_init(void);
void do_move(int destcol, int destline, int (*outc)(void));
/* userinfo.c */
void permtostr(int perm, char *str);
void disply_userinfo(struct userec *u, int real);
int uinfo_query(struct userec *u, int real);
void x_info(void);
void x_fillform(void);
/* vote.c */
void makevdir(char *bname);
void setvfile(char *buf, char *bname, char *filename);
int b_closepolls(void);
int vote_maintain(char *bname);
int b_vote_maintain(void);
int b_vote(void);
int b_results(void);
void m_vote(void);
void x_vote(void);
int x_results(void);
/* announce.c */
int valid_fname(char *str);
int countstr(char *s0, char *s1);
void a_prompt(int bot, char *pmt, char *buf, int len);
int a_Save(char *path, char *key, struct fileheader *fileinfo, int nomsg);
int check_import(char *anboard);
int an_log(char *action, char *path);
int a_Import(char *direct, struct fileheader *fileinfo, int nomsg);
int a_menusearch(char *path, char *key, int level);
void a_menu(char *maintitle, char *path, int lastlevel, int lastbmonly);
void linkto(char *path, char *fname, char *title);
int add_grp(char group[80], char gname[80], char bname[80], char title[80]);
int del_grp(char grp[80], char bname[80], char title[80]);
int edit_grp(char bname[80], char grp[80], char title[80], char newtitle[100]);
void Announce(void);
void Personal(char *cmd);
int logvisit(time_t timein, const char *path);
int getvisit(int n[2], const char *path);
int add_anpath(char *title, char *path);
int select_anpath(void);
int save_anpath(char titles[20][80], char paths[20][1024]);
int read_anpath(char titles[20][80], char paths[20][1024]);
/* sendmsg.c */
int canmsg(struct user_info *uin);
int canmsg_offline(char *uid);
int s_msg(void);
int do_sendmsg(char *uid, struct user_info *uentp, char msgstr[256], int mode, int userpid);
int wall(void);
int wall_telnet(void);
void r_msg2(void);
void r_msg(int sig);
void block_msg(void);
void unblock_msg(void);
int friend_login_wall(struct user_info *pageinfo);
int show_allmsgs(void);
/* bm.c */
int is_inprison(char *uident);
int deny_user(void);
int setclubmember(char *board, char *uid, int action);
int addclubmember(char *uident);
int clubmember(void);
int deny_from_article(int ent, struct fileheader *fileinfo, char *direct);
int clubmember_num(char *bname);
/* list.c */
int myfriend(unsigned uid);
int hisfriend(struct user_info *uentp);
void setlistrange(int i);
int t_friends(void);
int t_users(void);
int choose(int update, int defaultn, void (*title_show)(void), int (*key_deal)(int, int, int), int (*list_show)(void), int (*read)(int, int));
/* goodbye.c */
int countlogouts(char filename[80]);
void user_display(char *filename, int number, int mode);
void showstuff(char buf[256]);
/* bbsgopher.c */
int interrupt_chk(void);
void clear_gophertmpfile(void);
int readfield(int fd, char *ptr, int maxlen);
int readline(int fd, char *ptr, int maxlen);
int savetmpfile(char tmpname[]);
void print_gophertitle(void);
void printgopher_title(void);
void g_refresh(void);
int deal_gopherkey(int ch, int allnum, int pagenum);
void enterdir(char path[]);
int get_con(char *servername, int port);
int do_gopher(int page, int num);
int show_gopher(void);
void showout(void);
int gopher(char serv[], char dire[], int port, char title[]);
/* fileshm.c */
int fill_shmfile(int mode, char *fname, int shmkey);
void show_goodbyeshm(void);
void show_welcomeshm(void);
int show_endline(void);
/* postheader.c */
int post_header(struct postheader *header);
/* convcode.c */
int switch_code(void);
/* tmachine.c */
/* addressbook.c */
int addressbook(void);
/* backnumber.c */
void setbacknumberfile(char *path, char *filename);
int readbacknumber(int ent, struct bknheader *bkninfo, char *direct);
int new_backnumber(void);
int selectbacknumber(void);
int do_intobacknumber(char *filename, time_t t);
/* common.c */
int cmpIP(char *left, char *right);
/* sec_hand.c */
int sec_hand(void);
/* regular.c */
int checkf(char *str);
/* 1984.c */
void set1984file(char *path, char *filename);
void post_1984_to_board(char *dir, struct fileheader *fileinfo);
void post_to_1984(char *file, struct fileheader *fileinfo, int mode);
void do1984menu(void);
/* moneycenter.c */
int moneycenter(void);
/* editboard.c */
int chk_editboardperm(struct boardheader *bh);
int editboard(char *bname);
/* power_select.c */
int mkpowersymlink(char *direct);
void rmpower(void);
int rmpowersymlink(char *direct);
int power_action(char *filename, int id1, int id2, char *select, int action);
int power_select(int ent, struct fileheader *fileinfo, char *direct);
/* friendtest.c */
int friendshipTest(void);
/* posttmpl.c */
int into_posttmpl(void);
int new_posttmpl(void);
